// ignore_for_file: prefer_const_constructors

import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'data/listData.dart';
import 'data/udpPage.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  const MyStatelessWidget({super.key});
  List<Widget> _initListData() {
    List<Widget> list = [];
    list.add(const DrawerHeader(
      decoration: BoxDecoration(
        color: Colors.blue,
      ),
      child: Text("data"),
    ));

    for (var i = 0; i < listData.length; i++) {
      list.add(ListTile(
        title: Text("${listData[i]["title"]}",
            style: const TextStyle(
              fontWeight: FontWeight.w500,
              fontSize: 15,
            )),
        subtitle: Text("${listData[i]["subTitle"]}"),
        leading: Stack(
          alignment: Alignment.center,
          children: [
            Icon(
              listData[i]["icon"],
              color: Colors.blue[200],
            ),
          ],
        ),
      ));
      // list.add(listData)
    }
    return list;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          centerTitle: true,
          // leading: const Icon(Icons.menu_rounded),
          title: const Text('udpSentAssist'),
        ),
        drawer: Drawer(
          child: ListView(
            padding: const EdgeInsets.all(0),
            children: _initListData(),
          ),
        ),
        body: Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [Expanded(child: udpPageWidget())],
          ),
        ));
  }
}

void main(List<String> args) {
  runApp(MyApp());
}
